<?php
/**
 * This class consist functions that sets the values of a selectbox, check if its selectable and sets attribute values
 *
 * @author Redouane Benkaddour <redouane@indago.nl>
 * @version 0.5.2
 * @package reform
 * @subpackage select_attributes
 */
class select_attributes extends general_components {
	/**
	 * Values that will be selected
	 * @var array
	 */
	 protected $selected = array();

	 
	 /**
 	 * Array with values of the selectbox
 	 * @var array
 	 */
	 protected $_values = array();
	 
	 /**
 	 * Boolean for using the array key as value and the array value as title
 	 * @var boolean
 	 */
	 protected $use_key;
	  		
	/**
    * sets the values of an select box, selectable or non selectable.
    *
    * @param array $values
    * @param boolean $use_key
    * @param boolean $selectable
    * @param array $optgroup
    * @return void
    */
	public function addValues($values, $use_key = TRUE, $optgroup = 0){
	    $newArray[$optgroup] = array();
	    $newArray[$optgroup] = $values;
		
		$this->use_key = $use_key;
		
		if(count($this->_values) > 0){
			$this->_values[$optgroup] = array_merge($this->_values[$optgroup], $newArray[$optgroup]);
		}else{
			$this->_values[$optgroup] = $newArray[$optgroup];
		}
	}
	
	/**
    * sets the values that will be selected on loading.
    *
    * @param array $selected
    * @return void
    */
	public function setSelected($selected=array()){
		$this->selected[] = $selected;
	}
	
   
}

?>